#include <iostream>
using namespace std;
int m, n;
const int N = 2010;
int f[N][N];
void insert(int x, int y ,int i, int j)
{
    f[x][y] += 1;
    f[x][j + 1] -= 1;
    f[i + 1][y] -= 1;
    f[i + 1][j + 1] += 1;
}
int main()
{
    // 请在此输入您的
    cin >> n >> m;
    while (m--)
    {
        int x = 0, y = 0, i = 0, j = 0;
        cin >> x >> y >> i >> j;
        insert(x, y, i, j);
    }
    //还原
    for (int i = 1;i <= n;i++)
    {
        for (int j = 1;j <= n;j++)
        {
            f[i][j] += f[i - 1][j] + f[i][j - 1] - f[i - 1][j - 1];
            if (f[i][j] % 2 == 0) cout << '0';
            else cout << '1';
        }
        cout << endl;
    }
    return 0;
}